Electronic camera and image processing program

ABSTRACT

As the target compression rate is set higher, the ratio of a DC component quantization step and an AC component quantization step (referred to as a “DC/AC quantization ratio” is adjusted to a smaller value and then a compression size adjustment is implemented while sustaining the DC/AC quantization ratio at a substantially constant value. In addition, if the compression rate is set higher than a predetermined factor, the DC/AC quantization ratio is fixed at a constant value regardless of the target compression rate setting to prevent the DC component quantization step from becoming excessively small.

The disclosures of the following priority application is hereinincorporated by reference:

-   Japanese Patent Application No. H 11-230593 filed Aug. 17, 1999

TECHNICAL FIELD

The present invention relates to an electronic camera and an imageprocessing program having an image compression function.

BACKGROUND ART

Image data handled in an electronic camera or a computer normallyundergo image compression (e.g., JPEG compression) processing, in orderto efficiently record the image data at a recording medium. The imagecompression processing may be executed through, for instance, thefollowing steps 1˜6.

1. The electronic camera determines a target image data compression ratein correspondence to the compressed image quality setting selected bythe photographer (e.g., by switching to one of; FINE/NORMAL/BASIC).

2. The electronic camera divides the image data constituted of thebrightness Y and the color differences Cb, Cr blocks each made up of,for instance, 8×8 pixels. The electronic camera then implements DCT(discrete cosine transform) in units of the individual blocks resultingfrom the division and obtains transformation coefficients eachcorresponding to one of 8×8 discrete spatial frequencies.3. The electronic camera prepares reference quantization tables defininga quantization step in correspondence to each of the 8×8 transformationcoefficients. By multiplying the data in the reference quantizationtables by a scale factor SF (a type of compression parameter), theelectronic camera obtains a quantization table to be utilized in actualprocessing.4. The electronic camera quantizes each of 8×8 transformationcoefficients using the quantization tables obtained in step 3.5. The electronic camera compresses the quantized data by coding thedata through variable length coding, run-length coding or the like.6. If the compression size deviates from the allowable targetcompression rate range, the electronic camera first readjusts the valueof the scale factor SF and then re-engages in the operation in step 3above. If, on the other hand, the compression size is within theallowable target compression rate range, it ends the image compressionprocessing.

Through the processing described above, the image data can be compressedat a compression rate within the allowable target compression raterange.

Under normal circumstances, when compressing image data with a largeinformation volume in an electronic camera, the scale factor SF is setto a relatively high value in order to assure that the compression sizeis kept within the target compression rate range. When the scale factorSF increases, the step taken to quantize the DC component becomes largerand, as a result, significant quantization noise manifests in thequantized DC component. Such quantization noise in the DC component thenmanifests as pronounced block noise in the decompressed image.

For instance, when handling data of an image of sunlight filteringthrough leaves, significant block noise manifests over a flat area suchas a tree trunk while no significant block noise manifests over detailssuch as tree leaves and the like.

Block noise resulting from the compression size adjustment may beprevented by implementing a fixed DC component quantization step whichdoes not change regardless of the setting for the scale factor SF. Inthis case, since the DC component quantization step is fixed, there isno concern that block noise may result from the compression sizeadjustment.

However, these measures frequently lead to an undesirable phenomenon onthe opposite extreme in that if the scale factor SF is set to arelatively small value to process image data with a small informationvolume, the AC component quantization step becomes smaller than the DCcomponent quantization step. When such a reverse phenomenon occurs, thecompression distribution of the DC component/AC component becomes poorand the priority of compression is not given to information which isvisually important.

The block noise mentioned above may be prevented by individuallyadjusting the DC component quantization step and the AC componentquantization step. By implementing the individual adjustments, itbecomes possible to fully take into consideration all the importantfactors including the block noise, the compression size and thecompression distribution.

However, a greater number of parameters must be adjusted during thecompression size adjustment if the individual adjustments mentionedabove are implemented. In addition, the effects of the individualparameters on the compression size and the compressed image quality arecomplex and indeterminate. For this reason, it is difficult to executethe correct compression processing by individually adjusting theseparameters during the compression size adjustment. Furthermore, there isanother problem in that since the number of options for each parameterincreases, the compression size adjustment cannot be completed quickly.

DISCLOSURE OF THE INVENTION

An object of the present invention is to provide an electronic cameracapable of reliably minimizing the occurrence of block noise, sustaininga correct compression distribution of the DC component/AC component andexecuting the compression size adjustment with ease and reliability.

Another object of the present invention is to provide an imageprocessing program for implementing image compression processing thatmakes it possible to reliably minimize the occurrence of block noise,maintain a correct compression distribution of the DC component/ACcomponent and execute compression size adjustment with ease andreliability.

In order to achieve the objects described above, the electronic cameraaccording to the present invention comprises an image-capturing elementthat captures an image of a subject and outputs image data of thecaptured subject image and a compression processing unit that compressesthe image data by converting the image data to a spatial frequency DCcomponent and a spatial frequency AC component and by quantizing andcoding the two components. The compression processing unit includes aquantization ratio determining processing unit that determines the ratioof a DC component quantization step and an AC component quantizationstep (DC/AC quantization ratio) in correspondence to a targetcompression rate, a quantization adjustment processing unit that makesan adjustment on the DC component quantization step and the AC componentquantization step while sustaining the DC/AC quantization ratio at asubstantially constant value and a compression rate control processingunit that controls the quantization adjustment processing unit so that acompression code volume resulting from the compression can be within arange according to a target compression rate.

Since the DC/AC quantization ratio is determined in correspondence tothe target compression rate, the DC/AC quantization ratio can be set soas to ensure that no block noise will manifest in a situation in whichblock noise would occur if the constant DC/AC quantization ratioremained unchanged at all times, for instance. In addition, since the DCcomponent quantization step and the AC component quantization step areadjusted while sustaining the DC/AC quantization ratio at asubstantially constant value, the processing is simplified compared toprocessing achieved by individually adjusting the DC componentquantization step and the AC component quantization step andfurthermore, the compression code volume can be adjusted whilemaintaining good balance in the compression distribution of the DCcomponent and the AC component.

The DC/AC quantization ratio can be adjusted to a smaller value by thequantization ratio determining processing unit as the target compressionrate is set for higher compression.

Moreover, the quantization ratio determining processing unit may fix theDC/AC quantization ratio at a constant value regardless of the targetcompression rate setting when the target compression rate is higher thana predetermined value.

The program according to the present invention implements DCT processingin which image data are converted to a spatial frequency DC componentand a spatial frequency AC component, quantization ratio determiningprocessing in which the ratio of a DC component quantization step and anAC component quantization step (DC/AC quantization ratio) is determinedin correspondence to a target compression rate, quantization adjustmentprocessing in which the DC component quantization step and the ACcomponent quantization step are adjusted while sustaining the DC/ACquantization ratio at a substantially constant value and compressionrate control processing in which control is implemented on thequantization adjustment processing so that a compression code volumeresulting from the compression can be within a range according to atarget compression rate range. Through the program, the image data arecompressed by quantizing and coding the DC component and the ACcomponent. This image processing program may be stored in a recordingmedium which can be read by a computer or may be transmitted via acommunication line such as the Internet.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a schematic block diagram illustrating the structure adoptedin the electronic camera;

FIG. 2 is a flowchart of the first half of the image compressionprocessing implemented at the compression processing unit;

FIG. 3 is a flowchart of the second half of the image compressionprocessing implemented at the compression processing unit;

FIG. 4A shows the reference quantization table for the brightness Ycorresponding to a target compression rate of ¼;

FIG. 4B shows the reference quantization table for the color differencesCb and Cr corresponding to a target compression rate of ¼;

FIG. 5A shows the reference quantization table for the brightness Ycorresponding to target compression rates of ⅛ and 1/16;

FIG. 5B shows the reference quantization table for the color differencesCb and Cr corresponding to target compression rates of ⅛ and 1/16; and

FIGS. 6A and 6B show reference quantization tables used in the priorart.

BEST MODE FOR CARRYING OUT THE INVENTION

An embodiment of the present invention is now explained in reference tothe drawings.

FIG. 1 is a schematic block diagram illustrating the structure of anelectronic camera 10. The electronic camera 10 in FIG. 1 is mounted witha photographic lens 11. An image-capturing element 13 is provided in theimage space of the photographic lens 11. Image data generated at theimage-capturing element 13 sequentially undergo specific types ofprocessing at a signal processing unit 15, an A/D conversion unit 16 andan image processing unit 17, and then are input to a compressionprocessing unit 18 as digital image data. The compression processingunit 18 performs JPEG compression on the input image data and outputscompressed data to a recording unit 19. The recording unit 19 recordsthe input compressed image data to a recording medium (not shown) whichmay be a memory card.

In addition, the electronic camera 10 is provided with a control unit 21for implementing system control, an operating button group 24 throughwhich camera operations are performed and the compressed image quantityis set, and the like.

FIGS. 2 and 3 present a flowchart of the image compression processingimplemented at the compression processing unit 18. The following is anexplanation of the image compression processing which characterizes thepresent invention, given in reference to FIGS. 2 and 3. In step S1 inFIG. 2, the compression processing unit 18 ascertains the compressedimage quality setting (FINE, NORMAL, BASIC or the like in this example)selected at the operating button group 24 by engaging in communicationwith a control unit 21. The compression processing unit 18 determines atarget compression rate (¼ compression, ⅛ compression, 1/16 compressionin this example) in correspondence to the image quality setting that hasbeen ascertained. The compression processing unit 18 then performsinitial setting for the following parameters in correspondence to thetarget compression rate thus determined. It is to be noted that the codevolume resulting from the image compression, i.e., the compressed datasize, is to be referred to simply as the compression size.

-   -   Reference (or standard) quantization tables    -   Allowable compression size range Sspan    -   Initial scale factor SF1    -   Scale factor lower limit SFmin    -   Discontinuation scale factor SF4

FIG. 4A shows the reference quantization table for the brightness Y at atarget compression rate ¼. FIG. 4B shows the reference quantizationtable for the color differences (or chrominances) Cb and Cr at thetarget compression rate ¼. FIG. 5A shows the reference quantizationtable for the color differences Cb and Cr at target compression rates ⅛and 1/16. FIG. 5B shows the reference quantization table for the colordifferences Cb and Cr at the target compression rates ⅛ and 1/16. Inthese reference quantization tables, the numerical value in the upperleft corner, i.e., the DC component reference quantization step, isadjusted in correspondence to the target compression rate.

The remaining 63 numerical values excluding the numerical value in theupper left corner in each reference quantization table represent thedata used in the AC component reference quantization step determined incorrespondence to one of the transformation coefficients resulting fromthe DCT processing. A DC/AC quantization ratio is calculated by dividingthe DC component reference quantization step by the AC componentreference quantization step in each table.

In step S2 in FIG. 2, the compression processing unit 18 preparesquantization tables for test compression by multiplying all the elementsin the reference quantization tables set in step S1 by the initial scalefactor SF1.

In step S3, the compression processing unit 18 implements JPEGcompression on the image data by using the quantization tables for testcompression.

In step S4, the compression processing unit 18 correlates the results ofthe test compression to statistical data having been stored in advancein the memory provided within the compression processing unit 18 toestimate a correct scale factor SF2 for achieving the target compressionrate.

In step S5 the compression processing unit 18 sets a limit to theestimated scale factor SF2 with the lower limit SFmin.

In step S6, the compression processing unit 18 prepares quantizationtables by multiplying all the elements in the reference quantizationtables selected in step S1 by the scale factor SF2.

In step S7, the compression processing unit 18 implements JPEGcompression on the image data using the quantization tables thusprepared.

In step S8 in FIG. 3, the compression processing unit 18 makes adecision as to whether or not the compression size S is within theallowable range Sspan. If the compression size S is outside theallowable range Sspan and thus a negative decision is made, thecompression processing unit 18 proceeds to step S9. If, on the otherhand, an affirmative decision is made that the compression size S iswithin the allowable range Sspan, the compression processing unit 18judges that the desired image compression has been completed and endsthe image compression processing in FIG. 3.

In step S9, the compression processing unit 18 makes a decision as towhether or not conditions “the current compression rate is higher thanthe target compression rate” and “the scale factor SF2 is equal to thelower limit SFmin” are both satisfied. If the conditions are bothsatisfied, it can be assumed that the compression target image data area special type of image data with an extremely small information volume.Accordingly, the compression processing unit 18 discontinues ortruncates the image compression if an affirmative decision is made instep S9 and ends the image compression processing in FIG. 3. In thiscase, the image compression has been executed by using the lower limitSFmin. If, on the other hand, negative decision is made in step S9, thecompression processing unit 18 proceeds to step S10.

In step S10, the compression processing unit 18 correlates the resultsof the two compressions to the statistical data having been stored inadvance in the memory provided within the compression processing unit 18to estimate a correct scale factor SF3 for achieving the targetcompression rate.

In step S11, the compression processing unit 18 sets a limit to theestimated scale factor SF3 with the lower limit SFmin.

In step S12, the compression processing unit 18 prepares quantizationtables by multiplying all the elements in the reference quantizationtables selected in step S1 by the scale factor SF3.

In step S13, the compression processing unit 18 implements JPEGcompression on the image data using the quantization tables thusprepared.

In step S14, the compression processing unit 18 makes a decision as towhether or not the compression size S is within the allowable rangeSspan. If the compression size S is outside the allowable range Sspanand thus a negative decision is made, the compression processing unit 18proceeds to step S15 If, on the other hand, an affirmative decision ismade that the compression size S is within the allowable range Sspan,the compression processing unit 18 judges that the desired imagecompression has been completed and ends the image compression processingin FIG. 3.

In step S15, the compression processing unit 18 makes a decision as towhether or not conditions “the current compression rate is higher thanthe target compression rate” and “the scale factor SF3 is equal to thelower limit SFmin” are both satisfied. If the conditions are bothsatisfied, it can be assumed that the compression target image data area special type of image data with an extremely small information volume.Accordingly, the compression processing unit 18 discontinues the imagecompression if an affirmative decision is made in step S15 and ends theimage compression processing in FIG. 3. In this case, the imagecompression has been executed by using the quantization tables. If, onthe other hand, a negative decision is made in step S15, the compressionprocessing unit 18 proceeds to step S16.

In step S16, the compression processing unit 18 prepares quantizationtables by multiplying all the elements in the reference quantizationtables selected in step S1 by the discontinuation scale factor SF4.

In step S17, the compression processing unit 18 implements JPEGcompression on the image data using the quantization tables thusprepared.

In step S18, the compression processing unit 18 makes a decision as towhether or not the compression size S is equal to or smaller than (theupper limit to the allowable range Sspan). If a negative decision ismade, i.e., if it is decided that the compression size S exceeds (theupper limit to the allowable range Sspan), the compression processingunit 18 proceeds to step S19. If, on the other hand, the compressionsize satisfies a loose condition that it be equal to or smaller than(the upper limits to the allowable range Sspan) and thus an affirmativedecision is made, the compression processing unit 18 judges that thedesired image compression has been completed for the time being and endsthe image compression processing in FIG. 3.

In step S19, the compression processing unit 18 makes a decision as towhether or not the number of compression trials has exceeded the limit.If an affirmative decision is made that the number of compression trialshas exceeded the limit, the compression processing unit 18 discontinuesthe compression processing after obtaining the results of the mostrecent compression and ends the image compression processing in FIG. 3.If, on the other hand, the number of compression trials has not exceededthe limit and thus a negative decision is made, the compressionprocessing unit 18 proceeds to step S20.

In step S20, the compression processing unit 18 multiplies the scalefactor SF4 currently set by a predetermined factor (e.g., by a factor of1.5) before returning to step S16.

To summarize the actions and advantages achieved in the embodimentdescribed above, two types of reference quantization tables, i.e., thereference quantization tables corresponding to the ¼ compression and thereference quantization tables corresponding to the ⅛ and 1/16compressions are provided in the electronic camera, and if the targetcompression rate is higher than ¼, i.e., if the target compression rateis ⅛ or 1/16, the DC component quantization step is reduced. As aresult, if the AC component quantization step remains unchanged for the¼ compression and the ⅛ and 1/16 compressions, the DC/AC quantizationratio becomes smaller at a higher compression rate, making it possibleto prevent the occurrence of block noise due to an excessive expansionof the DC component quantization step with a high degree of reliability.

In addition, quantization tables are prepared by multiplying all theelements in the reference quantization tables, i.e., all thequantization steps including the DC component quantization step and theAC component quantization step by a scale factor. Thus, the DC/ACquantization ratio is sustained at a substantially constant value whenadjusting the compression size through a scale factor adjustment toachieve a good balance in the compression distribution of the DCcomponent/AC component regardless of whether the information volume inthe image data is large or small.

Furthermore, since the compression size is adjusted through theadjustment of the scale factor alone, it is not necessary to implementcomplex processing for individually adjusting the DC componentquantization step and the AC component quantization step. As a result,the compression size can be adjusted with ease and reliability.

In the explanation given above, once the target compression rate exceeds⅛ (e.g., when the target compression rate is 1/16), the DC componentreference quantization step is fixed by using the reference quantizationtables in FIG. 5. Consequently, the risk of the AC componentquantization step becoming expanded to an excessive degree or the riskof the DC component quantization step becoming too small is eliminated,making it possible to achieve a high quality compressed image at alltimes.

It is to be noted that while an explanation is given above by referringto specific examples of the reference quantization tables in FIGS. 4 and5, the table values are not limited to the numerical values presented inthe figures. Reference quantization tables should be obtained undernormal circumstances by conducting a subjective evaluation test (anevaluation test of block noise, the compression distribution and thelike) on the compressed image at each target compression rate and usingthe test results for reference.

INDUSTRIAL APPLICABILITY

While an explanation is given above in reference to an embodiment inwhich the present invention is adopted in an electronic camera, theimage compression processing and the flowchart in FIGS. 2 and 3 may beprovided as an image processing program which is stored in a recordingmedium. By executing this image processing program on a computer,actions and advantages similar to those realized in the embodimentdescribed above can be achieved.

In addition, actions and advantages similar to those realized in theembodiment can be achieved by transmitting the image processing programto the computer via a communication line and executing the transmittedimage processing program on the computer.

1. An electronic camera comprising: an image-capturing element thatcaptures an image of a subject and outputs image data of the capturedsubject image; a compression processing unit that compresses the imagedata by converting the image data to a spatial frequency DC componentand a spatial frequency AC component and by quantizing and coding thetwo components, wherein: said compression processing unit includes: aquantization ratio determining processing unit that determines a ratioof a DC component quantization step and an AC component quantizationstep (DC/AC quantization ratio) in correspondence to a targetcompression rate; a quantization adjustment processing unit that makesan adjustment on said DC component quantization step and said ACcomponent quantization step while sustaining the DC/AC quantizationratio at a substantially constant value; and a compression rate controlprocessing unit that controls said quantization adjustment processingunit so that a compression code volume resulting from the compressioncan be within a range according to a target compression rate.
 2. Anelectronic camera according to claim 1, wherein: said quantization ratiodetermining processing unit adjusts the DC/AC quantization ratio to asmaller value as the target compression rate is set higher.
 3. Anelectronic camera according to claim 1, wherein: said quantization ratiodetermining processing unit fixes the DC/AC quantization ratio at aconstant value regardless of the target compression rate when the targetcompression rate is set higher than a predetermined value.
 4. Acomputer-readable recording medium that stores an image processingprogram for compressing image data by quantizing and coding a DCcomponent and an AC component, the image processing program comprisinginstructions to perform: DCT processing in which the image data areconverted to a spatial frequency DC component and a spatial frequency ACcomponent; quantization ratio determining processing in which a ratio ofa DC component quantization step and an AC component quantization step(DC/AC quantization ratio) is determined in correspondence to a targetcompression rate; quantization adjustment processing in which said DCcomponent quantization step and said AC quantization step are adjustedwhile sustaining the DC/AC quantization ratio at a substantiallyconstant value; and compression rate control processing in which controlis implemented on the quantization adjustment processing so that acompression code volume resulting from the compression can be within arange according to a target compression rate.